package game.event;

import game.Game;
import game.Player;

public class ChatEvent extends Event<Message> {

	public ChatEvent(Player originator, Message message) {
		super(originator, message);
	}

	@Override
	public void perform(Game game) {
		game.displayMessage(this);		
	}

	public String getFormattedMessage() {
		StringBuilder output = new StringBuilder();
		output.append(getOriginator().getName());
		output.append(" ("+getFormattedTime()+"): ");
		output.append(getMessage());
		output.append("\n");
		return output.toString();
	}

	private String getMessage() {
		return getEvent().getText();
	}

}
